package com.art.hystrix.controller;

import com.art.common.utils.HttpResult;
import com.art.hystrix.controller.service.UserService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuhb
 * @date 2020/11/17
 */
@RestController
@RequestMapping("hytrix")
public class HytrixController {
    @Autowired
    private UserService userService;

    @GetMapping("/user/{id}")
    public HttpResult testFallback(@PathVariable Long id) {
        return userService.getUser(id);
    }

}
